Host: Windows (tested on XP, Vista, Win 7)
Guest: Linux (tested on Ubuntu and OpenSuse)
Many people have problems with access to shared directories using default Virtual Box options (and this article is direct effect of my problems with these features). Some people try to work this around by using pen-drives or other external devices to simply transfer data from guest to host (or other way) machine, but it is not only troublesome but also VERY inefficient. Thankfully there is fstab which can help us a lot with this issue.
But first things first...
IP Address
The first and most important thing which we will need is IP address of machine with shared directory to which we want to connect. It is worth to point out that this directory does not have be located on virtualization host machine - it can be either other virtual machine or entirely different physical machine in that network.
If we decide to connect with the same computer (physical machine) on which virtualization is launched that it good to know that by default host machine's IP is
10.0.2.2. In other words in most cases you can use this address instead of
Virtual Box network card.
However if that default address by any reason will not work correctly with shared folders than you should use IP address of Virtual Box cr eated card. You can acquire it by starting
cmd and running
"ipconfig" and in it's results find network card containing
"VirtualBox" in it's name... Or you can get it by clicking on VB menus

Select "Plik"->"Global settings"

Go to "Network" tab, select network adapter and click screwdriver icon

Host IP address is located on highlighted box
Share folder in Windows
While setting shared folder properties you should remember to allow save and modification access of folder content for user whom you want use to establish connection.
Linux magic
After starting OS create new folder which will be used for mounting network resource.
mkdir /mnt/win
Now open fstab file (/etc/fstab)
with root account and add line:
//192.167.56.1/Shared /mnt/win smbfs rw,umask=777,uid=LinuxUser,username=WinUser,password=WinPassword,auto 0 0
General form:
//{computer IP}/{shared resource name} {path to directory used for mounting shared resource} {file system} rw,umask=777,uid={Linux user name},username={Windows user name},password={Windows user password},auto 0 0
Be aware that Linux user used in this step will be owner of all files existing in this mounted directory
If you do not have installed
smbfs than you can replace it with
cifs - however you also need to enter a little different entry into your fstab file:
//192.167.56.1/Shared /mnt/win cifs file_mode=0777,dir_mode=0777,uid=LinuxUser,username=WinUser,password=WinPassword,auto 0 0
Remember to save changes in fstab file!
Last step
As a last step you need to mount resource via
mount:
mount /mnt/win
At that point you either mounted successfully network resource or saw info about occurred error...
Common issues
- "mount: unknown filesystem type 'smbfs'
Reason: Probably your system does not have installed smbfs :)
Solution: Try use cifs instead of smbfs or install smbfs (sudo apt-get install smbfs)
Comments
Write new comment